<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <button onclick="console.log(event.type)">保存</button>
    <button id="btn1">保存1</button>
    <button id="btn2">保存2</button>
    <script>
      const btn1 = document.getElementById("btn1");
      const btn2 = document.getElementById("btn2");
      btn1.onclick = function (e) {
        console.log(e.type);
      };
      btn2.addEventListener("click", function (e) {
        console.log(e.type);
      });
    </script>
  </body>
</html>
